How to Repair "Orphaned" Database in SQL Server 2016
You cannot attach a table to a database.  You can get the system to make a script for CREATE TABLE which you would then have to run on the other database.  However, you already have that script so you might as well use it.

If you know the table names that were accidentally created and you don't want to delete them one by one then you can make a quick script to delete the "bad" copies from the other database.

IF EXISTS (SELECT * FROM information_schema.tables WHERE name = 'badtable')
 DROP TABLE badtable;


In 2016 you could also:

DROP TABLE IF EXISTS dbo.badtable;