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

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[CustomerHidden]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  UPDATE Customer
  SET Customer.AnonymizeDate = CustomerHidden.DateStamp
  FROM Customer WITH (NOLOCK)
  INNER JOIN CustomerHidden WITH (NOLOCK) ON CustomerHidden.FKCustomerNumber = Customer.CustomerNumber
  WHERE Customer.AnonymizeDate IS NULL


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

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[ReservationAddressHidden]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  UPDATE ReservationAddress
  SET ReservationAddress.AnonymizeDate = ReservationAddressHidden.DateStamp
  FROM ReservationAddress WITH (NOLOCK)
  INNER JOIN ReservationAddressHidden WITH (NOLOCK) ON ReservationAddressHidden.FK_AddressNumber = ReservationAddress.AddressNumber
  WHERE ReservationAddress.AnonymizeDate IS NULL