If you know a particular product key is pirated, you could check for that various ways.
If you have a way to check this on the command line, wmi, registry, file, or anything that can out put to one of those, then yes.
The various recommendations made above, are good ones, but I’m not sure what happens when a pirate program fakes the genuine check, if that then causes it to appear genuine.
It really depends on the level of piracy you are trying to detect and what you would need to do to check it manually and how far you want to go.
If you have a site license for windows, you could just relicense everything.