The exact same way you create it using a designer. One of the specifications for an SQL Server is that it is managed using SQL commands, including setting up a new database, constructing tables, indexing, ... everything. SQL Servers are normally managed using, well, SQL.
So, you start with executing a properly crafted
CREATE DATABASE
[
^] command.