IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'gen_remitenteCorreo')
BEGIN
	EXEC [dbo].[_ini_creartabla] 'gen_remitenteCorreo', 1
END
GO

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'gen_remitenteCorreo' AND COLUMN_NAME = 'servidor')
BEGIN
	ALTER TABLE [gen_remitenteCorreo]
	ADD [servidor] VARCHAR(200)
END
GO

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'gen_remitenteCorreo' AND COLUMN_NAME = 'certificado')
BEGIN
	ALTER TABLE [gen_remitenteCorreo]
	ADD [certificado] BIT
END
GO

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'gen_remitenteCorreo' AND COLUMN_NAME = 'puerto')
BEGIN
	ALTER TABLE [gen_remitenteCorreo]
	ADD [puerto] VARCHAR(100)
END
GO

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'gen_remitenteCorreo' AND COLUMN_NAME = 'credenciales')
BEGIN
	ALTER TABLE [gen_remitenteCorreo]
	ADD [credenciales] VARCHAR(200)
END
GO

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'gen_envioCorreo' AND COLUMN_NAME = 'id_remitenteCorreo')
BEGIN
	ALTER TABLE [gen_envioCorreo]
	ADD [id_remitenteCorreo] INT
	FOREIGN KEY ([id_remitenteCorreo])
    REFERENCES gen_remitenteCorreo(id)
END
GO
