Strange Issue - Exists and Not Exists statements not works as expected, please find below attached screenshots


IF NOT EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'DatabaseVersionHistory' AND COLUMN_NAME = 'Patch')
BEGIN
print 'Reached Not Exists condition'
END
else
begin
print 'Reached Exists condition'
end