I created a schema script for an sql server database called test.
I want to execute this script in the same server where the test database is found, but for sure with different name, suppose test2.
when I opened the scripts, it starts by CREATE DATABASE [test] and the name test is used many times in the script. so how to safely change database name in the script without affecting the original database?
Note: changing name by just replacing it's name is not a solution because it's name is a part of many procedures and functions