How to know under which account/Apple ID an app was purchased?
There are 2 ways I can think of now:


Follow this step-by-step program to see your complete purchase history
Remove the app, make sure you're logged in on the right account and check if the just removed app has a cloud-symbol instead of "purchase" next to it.


Hope this helps.