Return list of values in conditional where clause I'm trying to filter a table based on a parameter that determines which list of values are allowed for a certain column. For @Parameter = 1 we want MyColumn to be either FirstValue or SecondValue; for @Parameter = 2 we want MyColumn to be either ThirdValue or FourthValue; otherwise we want all values of MyColumn.

This syntax clearly does not work:

declare @Parameter int = 1; -- can also be 2 or 3

select * 
from dbo.MyTable 
where MyColumn in 
(
    case @Parameter
        when 1 then (N'FirstValue', N'SecondValue') 
        when 2 then (N'ThirdValue', N'FourthValue') 
        else (N'FirstValue', N'SecondValue', N'ThirdValue', N'FourthValue') 
    end
);


What would be the best way to achieve this?

Edit: This works but is really clunky, so I would like to find a more elegant solution:

select * 
from dbo.MyTable 
    join 
    (
        values 
        (1, N'FirstValue'),
        (1, N'SecondValue'),
        (2, N'ThirdValue'),
        (2, N'FourthValue'),
        (3, N'FirstValue'),
        (3, N'SecondValue'),
        (3, N'ThirdValue'),
        (3, N'FourthValue')
    ) as temp(Option, Value)
    on MyTable.MyColumn = temp.Value
where temp.Option = @Parameter;
Maybe something like that could work:

declare @values table(id int, value nvarchar(100))
insert into @values
values(1, N'FirstValue'), (1, N'SecondValue'), (2, N'ThirdValue'), (2, N'FourthValue')

select * 
from dbo.MyTable t
join @values v on t.MyColumn = v.value
                and (v.id = @Parameter or @Parameter not in (1,2))