Well, the pill the cabbie put by the pink lady was the wrong one—we see her picking that one up, and we know she died.
So assuming that Hope made the same move with all his victims (and assuming that both pills weren’t poison), then the pill he set closest to himself was the right one. And that was the one Sherlock chose.
But since they both went flying when John shot the cabbie and Sherlock thus can’t know for sure which he chose even if he got them both tested, neither we nor he will ever know for sure.
(Possibly worth noting is that in the pilot, he hung onto it. Pilot Sherlock does know.)