IF NOT EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE ID = OBJECT_ID('EST_TRIB') AND name = 'FLAG_CTRL_ICMS_ST_RET')
	begin
		ALTER TABLE EST_TRIB ADD FLAG_CTRL_ICMS_ST_RET INT
		ALTER TABLE EST_TRIB ADD CONSTRAINT DF_EST_TRIB_FLAG_CTRL_ICMS_ST_RET DEFAULT 0 FOR FLAG_CTRL_ICMS_ST_RET
	end

GO

UPDATE EST_TRIB SET FLAG_CTRL_ICMS_ST_RET = 0 WHERE FLAG_CTRL_ICMS_ST_RET IS NULL