Obviously, @ast is null and Isnull will exchange null with another value, so you should not expect @ast to be null. If your AppSubType is NULL, the result becomes null, but AppSubType=nulldoes not mean that it AppSubType is nullis true. Since null is not a value, therefore, it cannot work with equal. for your expected result, this code will work.
declare @ast varchar(10)
set @ast = null
select *
from tbl
where AppType = 'SC' and (AppSubType = ISNULL(@ast, AppSubType) Or AppSubType is null)
source
share