you shall try this
Declare @status varchar(10);
set @status='pending'
declare @query varchar(500)
declare @where varchar(100)
set @query = 'select EntryNo,entryDt,EntryLMBY,convert(date,EntryLMDT,106)EntryLMDT,LOtNo_Site2HO,Cancelflag from dbo.tbl_Activity where '
select @where = case @status
when 'pending' then ' LOtNo_Site2HO IS NULL '
WHEN 'LotWise' THEN ' LOtNo_Site2HO=LOtNo_Site2HO '
WHEN 'Canceld' THEN ' CANCELFLAG=1 '
else ' 1=1 '
end
set @query = @query + @where
print @query
--exec(@query)