create proc abc( @condition varchar(2000))asbegin declare @strsql varchar(8000) set @strsql='select * from table1 where 1=1'+@condition+' order by id desc' print @strsql exec(@strsql)end