DECLARE @fk_name NVARCHAR(MAX)

SELECT TOP 1 @fk_name = name
FROM sys.foreign_keys
WHERE parent_object_id = object_id('adiantamento') AND object_name(referenced_object_id) = 'tipopagto'

DECLARE @sql NVARCHAR(MAX) = N'ALTER TABLE adiantamento DROP CONSTRAINT ' + @fk_name

IF @fk_name IS NOT NULL
	exec sp_executesql @sql