To remove a secondary database from an availability group
Connect to the server instance that hosts the secondary replica.
Use the SET HADR clause of the ALTER DATABASE statement, as follows:
ALTER DATABASE database_name SET HADR OFF
where database_name is the name of a secondary database to be removed from the availability group to which it belongs.
The following example removes the local secondary database MyDb2 from its availability group.

ALTER DATABASE MyDb2 SET HADR OFF;