Select <@WSTOCKID@> WSTOCKID, ITEMOPTIONSVALUES.* from ITEMOPTIONSVALUES where  
 ITEMOPTIONSVALUES.WITEMOPTIONVALUEID in (
SELECT distinct(a.WITEMOPTIONVALUE1ID) 
FROM STOCKOPTIONS a 
where a.WStockid = <@WSTOCKID@> and a.WITEMOPTIONVALUE1ID is not null
union
SELECT distinct(a.WITEMOPTIONVALUE2ID) 
FROM STOCKOPTIONS a 
where a.WStockid = <@WSTOCKID@> and a.WITEMOPTIONVALUE2ID is not null
union
SELECT distinct(a.WITEMOPTIONVALUE3ID) 
FROM STOCKOPTIONS a
where a.WStockid = <@WSTOCKID@> and a.WITEMOPTIONVALUE3ID is not null
union
SELECT distinct(a.WITEMOPTIONVALUE4ID) 
FROM STOCKOPTIONS a 
where a.WStockid = <@WSTOCKID@> and a.WITEMOPTIONVALUE4ID is not null
union
SELECT distinct(a.WITEMOPTIONVALUE5ID) 
FROM STOCKOPTIONS a 
where a.WStockid = <@WSTOCKID@> and a.WITEMOPTIONVALUE5ID is not null
)