IF EXISTS ( SELECT 1 FROM sysobjects where name = 'some_table' and type = 'U' ) -- do this if true ( maybe an update here ) SELECT 1 ELSE -- do this if false ( maybe an insert here ) SELECT 0