IF NOT EXISTS (SELECT * FROM SYS.COLUMNS WHERE NAME = 'FLAG_SPED' AND OBJECT_ID = OBJECT_ID('FP_CONTABILISTA'))
BEGIN
	ALTER TABLE dbo.FP_CONTABILISTA ADD
	FLAG_SPED tinyint NULL DEFAULT 0
END
go
	
DECLARE @QTDE AS INT

SET @QTDE = (SELECT COUNT (CD_EMP) FROM FP_CONTABILISTA)

IF  @QTDE = 1 
BEGIN
	UPDATE FP_CONTABILISTA SET FLAG_SPED = 1  
END

