IF Not (EXISTS(SELECT * FROM sysobjects WHERE name='IHIOActivityHistory'))
Begin
CREATE TABLE [dbo].[IHIOActivityHistory](
	[Id] [UNIQUEIDENTIFIER] NOT NULL,
	[ActionCode] [SMALLINT] NULL,
	[EntityName] [NVARCHAR](MAX) NULL,
	[JsonActivity] [NVARCHAR](MAX) NULL,
	[JsonResult] [NVARCHAR](MAX) NULL,
	[CreatedBy] [SMALLINT] NULL,
	[CreatedOn] [DATETIME] NULL,
 CONSTRAINT [PK_IHIOActivityHistory] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

ALTER TABLE [dbo].[IHIOActivityHistory] ADD  CONSTRAINT [DF_IHIOActivityHistory_Id]  DEFAULT (NEWID()) FOR [Id]
ALTER TABLE [dbo].[IHIOActivityHistory] ADD  CONSTRAINT [DF_IHIOActivityHistory_Act]  DEFAULT ((0)) FOR [ActionCode]
ALTER TABLE [dbo].[IHIOActivityHistory] ADD  CONSTRAINT [DF_IHIOActivityHistory_CreatedOn]  DEFAULT (GETDATE()) FOR [CreatedOn]
end