Not enough information. Need to see what and how you set @Query.
Also, the parameter definitions would be one variable, not two, and you're not setting the parameters to anything.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability