Yes, you can. You'll probably want to add metadata to the Items in the ItemGroup. Here's an example:
Command=""$(VSPath)" "%(LocalSolutionToBuild.Identity)" /Build "%(LocalSolutionToBuild.MSIConfig)|AnyCPU" /Out "$(BuildDirectory)\Package\MSILog.txt""
Condition="%(LocalSolutionToBuild.MSIConfig) != ''">
The LocalSolutionToBuild is an ItemGroup created from the "SolutionToBuild" ItemGroup using the WorkspaceItemConverterTask in TFS. The %(LocalSolutionToBuild.Identity) refers the "Include" attribute for the Item. %(LocalSolutionToBuild.MSIConfig)
referes to metadata. This will loop over all of the solutions in the ItemGroup and, if the metadata item "MSIConfig" is not empty, will call VS to build an MSI (it's an ugly hack but that's how you need to do it).
The ItemGroup looks like the following:
In your case, you'll define the ItemGroup for your databases and add whatever metadata you need.