

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'EST_PBM_PROJETO') AND type in (N'U'))
AND NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'EST_PBM_PROJETO' AND COLUMN_NAME = 'CD_PROJETO_EXT')
BEGIN

ALTER TABLE EST_PBM_PROJETO ADD CD_PROJETO_EXT INT NOT NULL CONSTRAINT DF_EST_PBM_PROJETO_CD_PROJETO_EXT DEFAULT 0

END
GO