I get a different error message if I try with MSSQL 2005 or 2008: Msg 166, which points out you can't use the DB name in create/alter procedure (and the next error is the one you showed). You will need to change the DB context prior to issuing a command creating or changing procedures or functions, as shown above.
The puzzling part is that you do not get the correct error message first ...

Trial 3:
So I tried to include the "USE TEST_DB GO" at the top of the CREATE PROCEDURE script. Though the execution from command line does not throw any error, the stored procedure gets created in MASTER db instead of TEST_DB.

USE TEST_DB GO CREATE PROCEDURE [dbo].[GetSP] @indate DateTime AS BEGIN SET NOCOUNT ON SELECT * FROM EMP WHERE EMP_JOIN_DATE > @indate; END --GO

Trial 4:
So I removed the "USE TEST_DB GO" from the top of "Create_StoredProcedures.sql" script, and included "USE TEST_DB" (without GO) in "Test.sql" right before invoking the "Create_StoredProcedures.sql" script (below is the code). This approaches throws "CREATE/ALTER PROCEDURE must be the first statement in a query batch."

Note:I get this same error, even when I include "USE TEST_DB" at the top of the "Create_StoredProcedures.sql" script with no "GO" in addition to "USE TEST_DB" without "GO" in "Test.sql" right before invoking the "Create_StoredProcedures.sql" script.

Trial 5:
So I retained the "USE TEST_DB GO" at the top of the "Create_StoredProcedures.sql" script and also included "USE TEST_DB" (without GO) in "Test.sql" right before invoking the "Create_StoredProcedures.sql" script (below is the code). Now it creates the stored procedure in TEST_DB.

So after including "USE TEST_DB" both in Test.sql and in Create_StoredProcedures.sql, with "GO" only inside "Create_StoredProcedures.sql" script, the stored procedure gets created in TEST_DB database.

My real problem:
My real "Test.sql" script has much more logic than what I have stated above. Below is the whole logic. Though Trial 5 created the stored procedure in TEST_DB, due to the GO inside the "Create_StoredProcedures.sql" script, the context of the variables declared in the "Test.sql" script gets lost (below is the code and error returned).

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

and then call sqlcmd with the proper DB (-d ...). That will solve the USE issue, but not the issue that each CREATE needs to be the only command in a T-SQL batch (and that rendering any var declaration void). That is the reason SSMS nowadays uses dynamic procedures to create procedures aso. That is, it fills a string with the command and executes that (with exec sp_executesql).

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.

This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel.
Part 1 of this series discussed basic error handling code using VBA.
http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…