IF NOT EXISTS(
    SELECT
        TOP 1 1
    FROM
        SYSCOLUMNS
    INNER JOIN SYSOBJECTS
	ON SYSOBJECTS.ID = SYSCOLUMNS.ID
    WHERE
        SYSCOLUMNS.NAME = 'GT02_ALIVA_CG28'
	AND SYSOBJECTS.NAME = 'GT02_CLIENTIFORNITORI'
)
	BEGIN
	   ALTER TABLE GT02_CLIENTIFORNITORI

			ADD GT02_ALIVA_CG28 CHAR(4) NULL 

	   PRINT 'Tabella GT02_CLIENTIFORNITORI: campo GT02_ALIVA_CG28 creato'

	END
ELSE
	BEGIN
		PRINT 'Tabella GT02_CLIENTIFORNITORI: campo GT02_ALIVA_CG28 esistente, creazione non effettuata'
	END
GO

IF NOT EXISTS(
    SELECT
        TOP 1 1
    FROM
        SYSCOLUMNS
    INNER JOIN SYSOBJECTS
	ON SYSOBJECTS.ID = SYSCOLUMNS.ID
    WHERE
        SYSCOLUMNS.NAME = 'GT13_ALIVA_CG28'
	AND SYSOBJECTS.NAME = 'GT13_DESTINATARI'
)
	BEGIN
	   ALTER TABLE GT13_DESTINATARI

			ADD GT13_ALIVA_CG28 CHAR(4) NULL 

	   PRINT 'Tabella GT13_DESTINATARI: campo GT13_ALIVA_CG28 creato'

	END
ELSE
	BEGIN
		PRINT 'Tabella GT13_DESTINATARI: campo GT13_ALIVA_CG28 esistente, creazione non effettuata'
	END
GO

IF NOT EXISTS(
    SELECT
        TOP 1 1
    FROM
        SYSCOLUMNS
    INNER JOIN SYSOBJECTS
	ON SYSOBJECTS.ID = SYSCOLUMNS.ID
    WHERE
        SYSCOLUMNS.NAME = 'GT03_ALIVA_CG28'
	AND SYSOBJECTS.NAME = 'GT03_DOCTESTATA'
)
	BEGIN
	   ALTER TABLE GT03_DOCTESTATA

			ADD GT03_ALIVA_CG28 CHAR(4) NULL 

	   PRINT 'Tabella GT03_DOCTESTATA: campo GT03_ALIVA_CG28 creato'

	END
ELSE
	BEGIN
		PRINT 'Tabella GT03_DOCTESTATA: campo GT03_ALIVA_CG28 esistente, creazione non effettuata'
	END
GO


	