@str_sem is not a direct condition in the where clause. It is only used to derive the term code list.

My revised version looks like this, but the second and third case here only can take single value, i.e. 'S2' or 'S2,S3', but not 'S2','S3' which is what I need.

select clo1 from mytablewhere (TERM_CODE not in (case @str_sem when 'full' then '' end) or TERM_CODE not in (case @str_sem when 'first' then 'S2' end)or TERM_CODE not in (case @str_sem when 'second' then 'S1' end))