IF NOT EXISTS
(
  SELECT SysColumns.Name 
  FROM SysObjects WITH (NOLOCK) 
    INNER JOIN SysColumns WITH (NOLOCK) ON SysColumns.Id = SysObjects.ID 
    AND SysColumns.Name = 'AddressAnonymized'
    WHERE SysObjects.Name = 'ReservationAddress'
)
  ALTER TABLE ReservationAddress ADD AddressAnonymized BIT NULL 
GO

IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[ReservationAddressHidden]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
  CREATE TABLE [dbo].[ReservationAddressHidden](
    [FK_AddressNumber] [int] NOT NULL,
    [DateStamp] [datetime] NOT NULL,
    [Title] [varchar](30) NULL,
    [Initial] [varchar](10) NULL,
    [FirstName] [varchar](50) NULL,
    [LastName] [varchar](50) NOT NULL,
    [Address1] [varchar](100) NULL,
    [Address2] [varchar](100) NULL,
    [Address3] [varchar](100) NULL,
    [CountryCode] [varchar](3) NULL,
    [ZipCode] [varchar](10) NULL,
    [City] [varchar](50) NULL,
    [Phone] [varchar](255) NULL,
    [Fax] [varchar](30) NULL,
    [Email] [varchar](96) NULL,
    [AttentionName] [varchar](50) NULL,
    [Link] [int] NULL,
    [CountryNumber] [int] NULL,
    [ContactpersonCustomerNumber] [int] NULL,
    [Cell] [varchar](255) NULL,
    [MemberCardNumber] [varchar](128) NULL,
    [MiddleName] [varchar](40) NULL,
    [Suffix] [varchar](40) NULL,
    [FK_RegionID] [int] NULL,
    [FK_BestWestern] [int] NULL,
    [AddressHidden] [bit] NULL,
  CONSTRAINT [PK_RESERVATIONADDRESSHIDDEN] PRIMARY KEY CLUSTERED 
  (
    [FK_AddressNumber] ASC
  )
  ) ON [PRIMARY]


  ALTER TABLE [dbo].[ReservationAddressHidden] ADD  CONSTRAINT [DF_ReservationAddressHidden_AddressHidden]  DEFAULT ((0)) FOR [AddressHidden]

  ALTER TABLE [dbo].[ReservationAddressHidden]  WITH NOCHECK ADD  CONSTRAINT [FK_ReservationAddressHidden_BestWesternFK] FOREIGN KEY([FK_BestWestern])
  REFERENCES [dbo].[BestWestern] ([BWR_ID])

  ALTER TABLE [dbo].[ReservationAddressHidden] NOCHECK CONSTRAINT [FK_ReservationAddressHidden_BestWesternFK]

  ALTER TABLE [dbo].[ReservationAddressHidden]  WITH NOCHECK ADD  CONSTRAINT [FK_ReservationAddressHidden_CUSTOMER] FOREIGN KEY([Link])
  REFERENCES [dbo].[Customer] ([CustomerNumber])

  ALTER TABLE [dbo].[ReservationAddressHidden] NOCHECK CONSTRAINT [FK_ReservationAddressHidden_CUSTOMER]

  ALTER TABLE [dbo].[ReservationAddressHidden]  WITH NOCHECK ADD  CONSTRAINT [FK_ReservationAddressHidden_CUSTOMER1] FOREIGN KEY([ContactpersonCustomerNumber])
  REFERENCES [dbo].[Customer] ([CustomerNumber])

  ALTER TABLE [dbo].[ReservationAddressHidden] NOCHECK CONSTRAINT [FK_ReservationAddressHidden_CUSTOMER1]

  ALTER TABLE [dbo].[ReservationAddressHidden]  WITH CHECK ADD  CONSTRAINT [FK_ReservationAddressHidden_RegionFK] FOREIGN KEY([FK_RegionID])
  REFERENCES [dbo].[Regions] ([ID])

  ALTER TABLE [dbo].[ReservationAddressHidden] CHECK CONSTRAINT [FK_ReservationAddressHidden_RegionFK]
END