What do you mean “in use” exactly?
If you are using the fixed-function pipeline, you can query which texture units are enabled and which are disabled. That’ll tell you which ones will be used the next time you draw something.
If you are using shaders, you can really kinda do the same thing. But you may be asking how many textures a specific shader makes use of, even before you’ve actually set up your texture units to draw with that shader. In which case you can iterate over the uniforms and see which of them are samplers.
If you need more specific help, please follow-up with whether you’re doing fixed-function pipeline or shaders here, and someone will help you out.