Image source: Getty Images.

Thinking about buying a pharmacy stock? That's not a bad idea. The U.S. population is aging and therefore requiring more prescription drugs, virtually ensuring growth for strong pharmacy chains. You won't find any stronger pharmacy companies than CVS Health (CVS -0.65%) and Walgreens Boots Alliance (WBA -1.18%). But which is the better pick for long-term investors? Let's see how the two pharmacy giants stack up. 

The case for CVS Health

If you look at CVS Health's stock chart, you might wonder if the company is on the wrong track. It hasn't been a good year so far.

CVS Chart

CVS data by YCharts.

This dismal year-to-date stock performance doesn't reflect the significant positives CVS Health has going for it over the long run, though. I'd put the company's Omnicare long-term care (LTC) pharmacy services high on the list. Around 70% of people over the age of 65 will eventually require some form of long-term care. Omnicare is the leading pharmacy services provider for the LTC market. 

CVS Health's acquisition of Target's 1,667 pharmacies and 79 clinics is another driver of growth. According to the CVS management team, the integration of those pharmacies and clinics has been one of the company's smoothest integrations ever.

From 2010 through 2015, CVS Health's core retail pharmacy business grew prescription volume roughly twice as fast as the rest of the retail pharmacy market. Introduction of generic drugs held back overall pharmacy same-store sales growth in the second quarter, but the company is still experiencing respectable growth. 

Then there's CVS Health's pharmacy benefits management (PBM) business, which saw revenue increase more than 20% in the first half of 2016 compared to the prior-year period. CVS Caremark had another solid selling season for the coming year, gaining net new business worth $4.6 billion. The PBM also retained 97.5% of existing customers.

Wall Street thinks that CVS Health will grow earnings over the next five years at roughly the same level the company achieved over the past five years. This projected growth rate of around 14.5% seems quite attainable.   

The case for Walgreens Boots Alliance

What about Walgreens Boots Alliance? The company's stock has fared better than CVS Health's in 2016, but the performance hasn't been exactly what you'd call exciting.

WBA Chart

WBA data by YCharts.

Walgreens beat CVS Health in the most recent quarter in pharmacy sales growth. Ditto for prescription growth. If the federal government doesn't throw a wrench into its plans, Walgreens might keep up those winning ways.

The company announced last year that it intended to buy rival pharmacy chain Rite Aid (RAD -51.21%). However, the U.S. Federal Trade Commission isn't making that acquisition an easy feat to pull off. Walgreens initially thought that it would divest around 500 stores to make the feds happy. In September, though, the company said the number would be higher but still below 1,000.If the Rite Aid deal goes through, it would make Walgreens the largest pharmacy chain the U.S., unseating CVS.

While Walgreens doesn't have a PBM unit like CVS Health does, it does claim a wholesale drug distribution business thanks to the merger with Alliance Boots in late 2014. That merger created synergies totaling $1 billion in fiscal 2016. The wholesale unit is growing especially strongly in emerging markets.

Better buy

Is CVS Health the better buy or should investors prefer Walgreens Boots Alliance? I think it's a pretty easy decision. Go with CVS Health.

Walgreens should do well in the future. I like its international exposure and suspect the Rite Aid deal will ultimately go through. However, CVS Health seems poised to grow faster. CVS is also priced more attractively after its larger stock drop this year. As icing on the cake, CVS Health's dividend yield edges out Walgreens' yield. These are both good companies, but we can only have one winner in a head-to-head matchup, and that winner is CVS.