I have a stored procedure that contains dynamic select. Something like this:
ALTER PROCEDURE [dbo].[usp_GetTestRecords] --@p1 int = 0, --@p2 int =
I got the same problem, and found solution here
It should be what you need now.