I have a where clause which I dynamically build that looks like this.

SET @orderstatus = ' (t.fieldvalue in ( ''PEND'', ''REDR'') or (t.fieldvalue=''NOTA'' and pr.isactive = 0)
or ((t.fieldvalue=''RXAP'' and m.formularymed = 0))
or (t.fieldvalue=''NOTA'' and pr.deano = @deano)) '

I then do @tsql = 'select * from table where ' + @orderstatus

The problem is I get the literal value @deano not the number that is stored in @deano