Od Đonny na
Visual Studio 2010 offers a new type of project for database development - *.dbproj. This new type of project can be "build". Build checks some syntax and consistency and mainly it creates some XML representation of your database including UDTs, stored procedures, tables and everything. This representation can be used to deploy database schema do any SQL Server database (create a new or upgrade existing).
I was just wondering if I can do this programatically from my code. The short answer is NO. The long answer is YES - and here is how: http://code.msdn.microsoft.com/dbDeploy.