How do I go about creating a script to compare , update and match structure of two databases
SQL Server Data Tools comes with Schema Compare (and a lot more).

1) Import either DB to a Database Project.


2) Bi-direction Schema Compare to remaining DB. Import and Deploy changes as necessary.


3) Save Solution to Source Control and deploy the exact same DB to any number of servers.

At any stage you can either script out the operations or simply execute it from the UI. The script includes checks to prevent data loss or other unwanted issues, but it's best to review especially if you're new to the tool.