You have to get individual IDs as rows of a table and then INNER JOIN onto this table to filter on passed IDswrite a UDF like thisCREATE FUNCTION SplitIDs@IDs varchar(8000)RETURNS @Results TABLE(ID int)AS DECLARE @N int,@Pos intWHILE @IDs IS NOT NULLBEGIN SET @Pos=CHARINDEX(',',@IDs) CASE WHEN @Pos >0 THEN SET @N=CAST(LEFT (@IDs,@Pos-1) AS Int) ELSE @N=CAST(@IDs AS Int) END INSERT INTO @Results VALUES (@N) SET @IDs= CASE WHEN @Pos >0 THEN RIGHT(@IDs,@Pos+1) ELSE NULL ENDENDGOThen use like this CREATE PROCEDURE get_product_names @ids varchar(50) ASSELECT ProductID, ProductNameFROM Northwind.Products pINNER JOIN SpiltIDs(@ids) tON t.ID = p.ProductID