I've run into this problem also in the past, and found some advice on the web to solve it. The solution I found was to parse the individual values from the input string, place them as rows into a temporary table, then use a subselect with the IN clause to get the values. Below is a simplification of the code I'm using. It assumes the values from the IN clause are smallints, it would be relaitvely easy to change to use a varchar.
For further reference, see this article with different ways to solve this issue.
DECLARE @TempList table
(
Enum smallint
)
DECLARE @Enum varchar(10), @Pos int
SET @ValueList = LTRIM(RTRIM(@ValueList))+ ','
SET @Pos = CHARINDEX(',', @ValueList, 1)
IF REPLACE(@ValueList, ',', '') ''
BEGIN
WHILE @Pos > 0
BEGIN
SET @Enum = LTRIM(RTRIM(LEFT(@ValueList, @Pos - 1)))
IF @Enum ''
BEGIN
INSERT INTO @TempList (Enum) VALUES (CAST(@Enum AS smallint)) --Use Appropriate conversion
END
SET @ValueList = RIGHT(@ValueList, LEN(@ValueList) - @Pos)
SET @Pos = CHARINDEX(',', @ValueList, 1)
END
END
SELECT *
FROM ExampleTable
WHERE
ExampleTable.Enum in (select Enum from @TempList)