I have simplified my problem to the following select statement.
select
u.UserId,
aVariable = cast((case when exists(select * from TblUser u where u.Disabled=1) then 1 else 0 end) as bit),
from TblUser u
where aVariable = 1
aVariable is not a column of a table, but just a column that gets a value in this select statement.
Is there a way to do the above without getting the Invalid column name aVariable error?