This solution is probably known to a lot of you out there, but for the ones who don’t, here is the solution in a Step-By-Step tutorial:
In SQL Server Management Studio right click on one of the databases on your Object Explorer, and choose Tasks->Generate Scripts…:
Then you’ll be introduced with the SQL Server Scripts Wizard:

Next, you need to choose the database you would like to generate scripts for, in this step you can choose whether to script all objects in your database, or you can set the ones you want in a latter step:

Now you need to choose your script options:
In the following steps you need to configure which object types you would like to script, and choose the specific objects (unless you decided to check the “Script all objects in the selected database” option):
The Object types you want to script:
And the objects:
In the last step, you need to choose where to output the script to:

That’s it.
Hope you’ll find it useful.