function Remove-Database {
    Removes (Drops) the specified SQL database
    Removes / Drops the specified SQL database from the SQL Server instance
    .PARAMETER Server
    Name of the target server, including instance and port if required.
    .PARAMETER Database
    The name of the database to be deleted.
    .PARAMETER Credential
    [Optional] A PSCredential object containing the credentials to connect to the AAS server.
    Remove-Database -Server 'localhost' -Database 'MyTestDB'
    Connects to the server localhost to remove the database MyTestDB
    Remove-Database -Server 'localhost' -Database 'MyTestDB' -Credential myCred
    Connects to the server localhost using the credential supplied in myCred to remove the database MyTestDB
    Written by (c) Dr. John Tunnicliffe, 2019-2021
    This PowerShell script is released under the MIT license

        [String] [Parameter(Mandatory = $true)]

        [String] [Parameter(Mandatory = $true)]

        [PSCredential] [Parameter(Mandatory = $false)]
        $Credential = $null

    $sqlCmd = "drop database [$Database]";
    if ($null -eq $Credential) {
        Invoke-Sqlcmd -Server $Server -Database 'master' -Query $sqlCmd -ErrorAction Stop;
    } else {
        Invoke-Sqlcmd -Server $Server -Database 'master' -Query $sqlCmd -ErrorAction Stop -Credential $Credential;
New-Alias -Name Remove-Database -Value Unpublish-Database;