IF NOT EXISTS
(
    SELECT *
    FROM   SYS.COLUMNS
    WHERE  NAME = 'TP_REGIME_APURAC_PIS_COFINS'
		 AND OBJECT_ID = OBJECT_ID('PRC_FILIAL')
)
	BEGIN
		ALTER TABLE PRC_FILIAL ADD TP_REGIME_APURAC_PIS_COFINS INT
		ALTER TABLE PRC_FILIAL ADD CONSTRAINT DF_PRC_FILIAL_TP_REGIME_APURAC_PIS_COFINS DEFAULT 0 FOR TP_REGIME_APURAC_PIS_COFINS	
	END

GO

UPDATE PRC_FILIAL SET TP_REGIME_APURAC_PIS_COFINS = 0 WHERE TP_REGIME_APURAC_PIS_COFINS IS NULL;





