To use dynamic SQL like you are doing you will have to compose the query string including the parameters and then run it as a dynamic SQL. However, that is very unsafe because of SQL injection risks. The two alternatives I can think of are:a) compose your query like this:SELECT FCPFROM [person]WHERE ','+@OrgCodes+',' LIKE '%,'+CAST(OrgCode AS VARCHAR(32)) + ',%';
b) Use a splitter function (such as the one described in Jeff Moden's article here - see Fig 21 of the article: http://www.sqlservercentral.com/articles/Tally+Table/72993/) Then your query would be:SELECT FCPFROM Person pWHERE Orgcode IN (SELECT Item FROM MASTER.dbo.DelimitedSplit8K(@OrgCodes,',') )