IF EXISTS (SELECT Id FROM CamposRelatorios WHERE relatorio = 27 and campo = 'VENCIMENTO') BEGIN DELETE FROM CamposRelatorios WHERE id in (SELECT Id FROM CamposRelatorios WHERE relatorio = 27 and campo = 'VENCIMENTO'); END