IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE Id = object_id(N'[dbo].[IdentityOTALog]') AND OBJECTPROPERTY(Id, N'IsUserTable') = 1)
BEGIN
  CREATE TABLE [dbo].[IdentityOTALog]
  (
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [Field1] [int] NULL,
    CONSTRAINT [PK_IdentityOTALog] PRIMARY KEY CLUSTERED 
    (
      [Id] ASC
    )
  ) ON [PRIMARY]

  DECLARE @Max INT

  IF EXISTS (SELECT * FROM dbo.sysobjects WHERE Id = object_id(N'[dbo].[OTALogBase]') AND OBJECTPROPERTY(Id, N'IsUserTable') = 1)
  BEGIN
    SELECT @Max = MAX(OTALogId) + 1 FROM OTALogBase WITH (NOLOCK)
    SET @Max = ISNULL(@Max, 0)
    DBCC checkident ('IdentityOTALog', reseed, @Max)
  END
END