DECLARE @col_length nvarchar(max)

SELECT @col_length = COL_LENGTH('[dbo].[adiantamento]', 'datapgt')

DECLARE @sql NVARCHAR(MAX) = N'UPDATE adiantamento SET Pagamento = datapgt WHERE Pagamento IS NULL AND datapgt IS NOT NULL;'

IF @col_length IS NOT NULL
    exec sp_executesql @sql