bungkus kueri dinamis dalam blok IF yang menguji apakah kueri akan mengembalikan apa pun.
select 'if exists (' + QUERY + ')' + char(10) + ' ' + QUERY
from (
select QUERY = 'select * from ' + TABLE_NAME
+ ' where ' + COLUMN_NAME + ' = 123'
from INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME like '%columnOfInterest%'
) q