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

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

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

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

IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[CustomerHidden]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE [dbo].[CustomerHidden](
	[FKCustomerNumber] [int] NOT NULL,
	[DateStamp] [datetime] NOT NULL,
	[FirstName] [varchar](50) NULL,
	[LastName] [varchar](60) NULL,
	[Address1] [varchar](100) NULL,
	[Address2] [varchar](100) NULL,
	[Address3] [varchar](100) NULL,
	[ZipCodeOverwrite] [varchar](10) NULL,
	[PhoneNumber] [varchar](30) NULL,
	[TelexNumber] [varchar](30) NULL,
	[FaxNumber] [varchar](30) NULL,
	[CellPhoneNumber] [varchar](30) NULL,
	[Title] [varchar](100) NULL,
	[WWWAddress] [varchar](100) NULL,
	[MemberCardNumber] [varchar](128) NULL,
	[GenderTitle] [varchar](50) NULL,
	[CountryNumber] [int] NULL,
	[CityOverWrite] [varchar](50) NULL,
	[PassPortNumber] [varchar](25) NULL,
	[MiddleName] [varchar](40) NULL,
	[Suffix] [varchar](40) NULL,
	[AddressHidden] [bit] NULL,
 CONSTRAINT [PK_CustomerHidden] PRIMARY KEY CLUSTERED 
(
	[FKCustomerNumber] ASC
)
) ON [PRIMARY]

ALTER TABLE [dbo].[CustomerHidden]  WITH CHECK ADD  CONSTRAINT [FK_CustomerHidden_Customer] FOREIGN KEY([FKCustomerNumber])
REFERENCES [dbo].[Customer] ([CustomerNumber])

ALTER TABLE [dbo].[CustomerHidden] CHECK CONSTRAINT [FK_CustomerHidden_Customer]
END