Cannot reuse a deleted Managed Service Application name in SharePoint 2010
If you arrive in a situation where you delete a managed service application, then try and recreate it with the same name, you will get an error like this;
The application pool could not be created because the name is already in use. Select “Use existing application pool” or provide another name for the application pool.
Deleting the managed service application hasn’t removed the application, and because that name exists you need to remove it before you can reuse it. To do this first of all, open the SharePoint PowerShell window and run the following command;
When the list appears, you should see the relevant managed service application name. From here, run this command;
Remove-SpServiceApplicationPool “APPLICATION NAME HERE”
At this stage, you can run the Get command again, to ensure its gone. If so, simply try and recreate your managed service application as required.