<?xml version="1.0" encoding="utf-8" ?> 
<TemplateProc>

<Script><![CDATA[

IF EXISTS (SELECT * FROM SYSOBJECTS WHERE ID = OBJECT_ID(N'[%%TableName%%]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
	%%ScriptField%%
END
ELSE
BEGIN
	CREATE TABLE %%TableName%% (%%CampoChave%% INT IDENTITY(1,1) PRIMARY KEY CLUSTERED, %%CampoUsuario%% INT, %%CampoGUID%% VARCHAR(36) NULL, %%CampoParentGUID%% VARCHAR(36) NULL)
	%%ScriptFieldNew%%
END

IF EXISTS (SELECT * FROM SYSOBJECTS WHERE ID = OBJECT_ID(N'[%%ProcSave%%]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
	DROP PROCEDURE [%%ProcSave%%]
IF EXISTS (SELECT * FROM SYSOBJECTS WHERE ID = OBJECT_ID(N'[%%ProcDel%%]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
	DROP PROCEDURE [%%ProcDel%%]
IF EXISTS (SELECT * FROM SYSOBJECTS WHERE ID = OBJECT_ID(N'[%%ProcList%%]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
	DROP PROCEDURE [%%ProcList%%]
IF EXISTS (SELECT * FROM SYSOBJECTS WHERE ID = OBJECT_ID(N'[%%ProcGet%%]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
	DROP PROCEDURE [%%ProcGet%%]
IF EXISTS (SELECT * FROM SYSOBJECTS WHERE ID = OBJECT_ID(N'[%%ProcGetByParent%%]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
	DROP PROCEDURE [%%ProcGetByParent%%]

]]></Script>

</TemplateProc>