IF NOT EXISTS(SELECT 1
FROM sysobjects,
syscolumns
WHERE sysobjects.id = syscolumns.id
AND sysobjects.name = 'Soggetti'
AND syscolumns.name = 'MatDaOre')
BEGIN
ALTER TABLE Soggetti
ADD MatDaOre int NOT NULL CONSTRAINT MatDaOre DEFAULT ('0') 
END

IF NOT EXISTS(SELECT 1
FROM sysobjects,
syscolumns
WHERE sysobjects.id = syscolumns.id
AND sysobjects.name = 'Soggetti'
AND syscolumns.name = 'MatDaMin')
BEGIN
ALTER TABLE Soggetti
ADD MatDaMin int NOT NULL CONSTRAINT MatDaMin DEFAULT ('0') 
END
IF NOT EXISTS(SELECT 1
FROM sysobjects,
syscolumns
WHERE sysobjects.id = syscolumns.id
AND sysobjects.name = 'Soggetti'
AND syscolumns.name = 'MatAOre')
BEGIN
ALTER TABLE Soggetti
ADD MatAOre int NOT NULL CONSTRAINT MatAOre DEFAULT ('0') 
END
IF NOT EXISTS(SELECT 1
FROM sysobjects,
syscolumns
WHERE sysobjects.id = syscolumns.id
AND sysobjects.name = 'Soggetti'
AND syscolumns.name = 'MatAMin')
BEGIN
ALTER TABLE Soggetti
ADD MatAMin int NOT NULL CONSTRAINT MatAMin DEFAULT ('0') 
END

IF NOT EXISTS(SELECT 1
FROM sysobjects,
syscolumns
WHERE sysobjects.id = syscolumns.id
AND sysobjects.name = 'Soggetti'
AND syscolumns.name = 'PomDaOre')
BEGIN
ALTER TABLE Soggetti
ADD PomDaOre int NOT NULL CONSTRAINT PomDaOre DEFAULT ('0') 
END

IF NOT EXISTS(SELECT 1
FROM sysobjects,
syscolumns
WHERE sysobjects.id = syscolumns.id
AND sysobjects.name = 'Soggetti'
AND syscolumns.name = 'PomDaMin')
BEGIN
ALTER TABLE Soggetti
ADD PomDaMin int NOT NULL CONSTRAINT PomDaMin DEFAULT ('0') 
END
IF NOT EXISTS(SELECT 1
FROM sysobjects,
syscolumns
WHERE sysobjects.id = syscolumns.id
AND sysobjects.name = 'Soggetti'
AND syscolumns.name = 'PomAOre')
BEGIN
ALTER TABLE Soggetti
ADD PomAOre int NOT NULL CONSTRAINT PomAOre DEFAULT ('0') 
IF NOT EXISTS(SELECT 1
FROM sysobjects,
syscolumns
WHERE sysobjects.id = syscolumns.id
AND sysobjects.name = 'Soggetti'
AND syscolumns.name = 'PomAMin')
BEGIN
ALTER TABLE Soggetti
ADD PomAMin int NOT NULL CONSTRAINT PomAMin DEFAULT ('0') 
END
IF NOT EXISTS(SELECT 1
FROM sysobjects,
syscolumns
WHERE sysobjects.id = syscolumns.id
AND sysobjects.name = 'Soggetti'
AND syscolumns.name = 'Sconto')
BEGIN
ALTER TABLE Soggetti
ADD Sconto int NOT NULL CONSTRAINT Sconto DEFAULT ('0') 
END
END