When there are multiple values in a single input parameter for a SP we can use sp_executesql .
Assume the query is like below.
select * from Item where ListId in ('IT/03218-ACC','IT/03253-ACC')
When we use this inside a SP,
CREATE PROCEDURE [dbo].[SP_ItemBlog]
(
@ItemList varchar(max)
)
AS
DECLARE @ItemQuery varchar(max) ='',
@Query nvarchar(max)
IF @ItemList <>''
BEGIN
SET @ItemList = REPLACE(@ItemList,'`','''')
END
BEGIN
SET @Query ='select * from Item where ListId in ('+@ItemList+')'
EXECUTE sp_executesql @Query
print @Query
END
Execute SP
SP_ItemBlog '`IT/03218-ACC`,`IT/03253-ACC`'