Some countries such as Australia have drug testing in place already for illegal drugs such as cannibas and LSD. This could be expanded to included prescription drugs with or without the pilots knowledge.
Legal, opiate based drugs can lead to a positive test result and licence suspension whilst the matter is sorted out.
Athletes have a long list of forbidden medications due to stringent drug testing during events, but these are more biased towards performance enhancing drugs.
Perhaps we'll end up with a similar list.