For an automated setup build that generates the setup for an application which uses Microsoft SQL Server, I am currently evaluating whether the following is possible:
Microsoft has also released a tool called 'mssql-scripter'. It can be found here: mssql-scripter