IF NOT (EXISTS
(
    SELECT name
    FROM sysobjects
    WHERE name = 'TrackingDetail'
)
       )

Begin
CREATE TABLE [dbo].[TrackingDetail](
	[Id] [UNIQUEIDENTIFIER] NOT NULL,
	[TrackingHeaderId] [UNIQUEIDENTIFIER] NOT NULL,
	[TrackingDate] [DATETIME] NULL,
	[Status] [TINYINT] NOT NULL,
	[IsDone] [BIT] NOT NULL,
 CONSTRAINT [PK_EshopTracking] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)
) ON [PRIMARY]
ALTER TABLE [dbo].[TrackingDetail] ADD  CONSTRAINT [DF_EshopTracking_TrackingId]  DEFAULT (NEWID()) FOR [Id]
ALTER TABLE [dbo].[TrackingDetail] ADD  CONSTRAINT [DF_EshopTracking_Status]  DEFAULT ((1)) FOR [Status]
ALTER TABLE [dbo].[TrackingDetail] ADD  CONSTRAINT [DF_TrackingDetail_IsDone]  DEFAULT ((0)) FOR [IsDone]
End
