Jeff Mlakar shows how you can use Management Studio to generate scripts for database objects:
Sales.SalesOrderDetail looks like a good choice. Let’s generate a script for that table, all associated objects, and its data.
The safest way to create structure including all indexes, keys, defaults, constraints, dependencies, triggers, etc. is to use SSMS Generate Scripts.
I would also recommend becoming familiar with the Powershell command to generate scripts and what dbatools has on store.