IF COL_LENGTH('CRM_Mails', 'Id_Trans') IS NULL 
BEGIN
	ALTER TABLE CRM_Mails ADD Id_Trans INT
	CREATE INDEX IX_CML_PorTrans ON CRM_Mails (Id_Trans)
	ALTER TABLE CRM_Mails ADD CONSTRAINT FK_CML_Cbtes FOREIGN KEY (Id_Trans)
		REFERENCES Cbtes (Id_Trans)

END
GO