• Let you try to read this article.

    http://www.databasejournal.com/features/mssql/article.php/2205291/Generate-Scripts-for-SQL-Server-Objects.htm

    I hope can help your issue.

    Regards,

    Eko Indriyawan