You can't have a where clause as a parameter.
I recommend you read this section of MVP Erland Sommarskog's article on the subject, and the whole article in general.
You could make this work without a parameter, even if it's not a good idea, by appending to your SQL string directly:
DECLARE @sql NVARCHAR(MAX) = NULL
DECLARE @WHERE NVARCHAR(MAX) = NULL
SET @sql = N'SELECT * FROM MyTable' + ISNULL(' WHERE ' + @WHERE, '');
EXECUTE sp_executesql @sql