I also wonder how drugstores manage all the patients' data. For my part, I pay in cash, and never give personally identifiable information unless strictly necessary.
In the US a drugstore's information falls under HIPAA which isn't perfect but does force some compliance at risk of large fines. HIPAA basically doesn't allow identified information to be shared except specifically related to treating or paying for your illness. Unlike a fly by night app a drugstore has a physical presence which means that tracking them down to fine is easier.
Look up prescription surveillance, prescription drug monitoring programs, and the companies that sell prescription data to see how “private” your private prescription info is.
Doesn't help if they have your prescription saved in a database