What a difference a year can make. In 2017, shares of AbbVie (NYSE:ABBV) skyrocketed more than 50%, while Merck (NYSE:MRK) stock fell 4%. But so far this year, Merck is a big winner, while AbbVie is down by a double-digit percentage.

And none of that matters very much when it comes to choosing which of these big-pharma stocks is the better buy. What matters are the prospects for the companies' current drugs and pipeline candidates.

Which stock is likely to be the bigger winner over the long run? Here's how AbbVie and Merck stack up against each other. 

Test tubes containing increasingly higher levels of green fluid with an upward-sloping green arrow drawn behind them.

Image source: Getty Images.

The case for AbbVie

To understand the case for AbbVie, it's also helpful to know a little about the company's challenges. The primary reason why AbbVie stock hasn't performed very well in 2018 relates to concerns about biosimilar competition for AbbVie's top-selling drug, Humira. It didn't help that AbbVie also experienced a significant pipeline setback this year with disappointing clinical results for experimental cancer drug Rova-T.

But AbbVie's challenges also underscore its strengths. Although Humira now faces biosimilar competition in Europe, biosimilars won't reach the more lucrative U.S. market until 2023. As a result, Humira is likely to remain the world's top-selling drug at least through 2024.

AbbVie had hoped that Rova-T would be successful. Even without the drug, though, the company's pipeline claims several potential blockbusters, notably including immunology drugs risankizumab and upadacitinib. AbbVie thinks that risankizumab and upadacitinib could generate peak annual sales of around $5 billion and $6.5 billion, respectively.

Meanwhile, the pipeline has already produced some big winners in recent years. Cancer drug Imbruvica continues to enjoy strong momentum thanks in part to new approved indications. Hepatitis C virus (HCV) drug Mavyret is off to an impressive start. AbbVie has high hopes for its endometriosis pain drug Orilissa and cancer drug Venclexta as well.

Because of AbbVie's solid current lineup and pipeline, Wall Street analysts project the company will grow earnings by nearly 17% annually on average over the next five years. That level of growth makes AbbVie stock look like a bargain, with shares trading at less than 10 times expected earnings.

In addition, AbbVie boasts one of the best dividends in healthcare. Its dividend currently yields 5%. AbbVie has increased its dividend by a whopping 140% since 2013.

The case for Merck

Since we started with AbbVie's baggage, it's only fair to look at the negatives for Merck as well. Sales continue to decline for several of Merck's older products, including immunology drugs Simponi and Remicade, HCV drug Zepatier, and cardiovascular drugs Zetia and Vytorin.

But Merck has a not-so-secret weapon that has driven the company's success -- Keytruda. The drug is already a huge winner in treating multiple types of cancer. Keytruda seems destined to become the No. 2 best-selling drug in the world within the next six years, trailing only AbbVie's Humira.

Merck also has two other cancer drugs, Lynparza and Lenvima, that it co-markets with partners that are just beginning to pick up momentum. Sales are also resurging for the company's biggest seller other than Keytruda, human papillomavirus (HPV) vaccine Gardasil.

What about Merck's pipeline? The biggest focus, at least in late-stage development, is on obtaining new indications for already-approved drugs, especially Keytruda. However, Merck has eight new candidates in late-stage testing. Probably the most promising of these is pneumoconjugate vaccine V114, which pharmaceutical market researcher EvaluatePharma ranks among the top five vaccines currently in development based on projected 2024 sales.

Wall Street analysts think that Keytruda should largely fuel Merck's growth for a while, with the drugmaker delivering average annual earnings growth of more than 9% over the next five years. Because of Merck's big run this year, though, its stock isn't as attractively valued as AbbVie's. Merck doesn't look too expensive, however, with shares trading at less than 16 times expected earnings.

The big pharma company's dividend yield of 2.88% isn't too shabby, either. Merck recently boosted its dividend by 15%, the largest dividend hike from the company in years.

Better buy

Keytruda is a monster success story for Merck. But I think AbbVie is more likely to be the bigger winner over the long run.

The sell-off in AbbVie stock this year is way overdone, in my view, based on the company's prospects. Sure, Humira's shine will fade. However, AbbVie's other rapidly growing drugs and its strong pipeline should drive sales and earnings higher for years to come. 

I think that AbbVie offers a total package for investors -- solid growth prospects, a strong dividend, and an attractive valuation. These factors make it a great stock for investors to buy and hold. 

Keith Speights owns shares of AbbVie. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.