DECLARE @Id AS BIGINT
Select @Id = Id From sysobjects Where Name = 'History_Detail_Factors'
if not Exists(SELECT * FROM syscolumns WHERE id = @Id and Name = 'TransactionType')
  Alter Table History_Detail_Factors Add TransactionType Int DEFAULT(0) 