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

  DECLARE @Max INT

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