You can do something like shown below, assuing the parameters are @xparam, @yparam and @zparam and assuming they are comma-separated values:select x,y,z from Tablewhere (','+@xparam+',' like '%,ALL,%' or ','+@xparam+',' like '%,'+x+',%') and (','+@yparam+',' like '%,ALL,%' or ','+@yparam+',' like '%,'+y+',%') and (','+@zparam+',' like '%,ALL,%' or ','+@zparam+',' like '%,'+y+',%')
This may have performance issues - take a look at this page if you do: http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/