HCA Holdings (HCA -0.91%) won't formally report its second quarter earnings until July 29, but it served up a tasty appetizer on July 16 when it unexpectedly raised full-year guidance. The company also pre-announced second quarter numbers far above estimates.

HCA's previewed $170 million earnings beat led to a broad hospital sector rally.

For the full year, HCA forecast 2014 per-share earnings at $4-$4.25. That's versus earlier guidance of $3.45- $3.75.

HCA's projected second quarter revenue now stands at $9.23 billion, up from  $8.45 billion in the second quarter of 2013. Adjusted EBITDA for the second quarter moved to $2 billion, compared to $1.7 billion the previous year's quarter.

Hospitals hit on Obamacare ruling
It all sounded great until last week, when the hospital sector was hit by headlines that a U.S. appeals court threw out a key piece of Obamacare. Just when that unsettling news hit the wires, another federal appeals court ruled the opposite, throwing things further into limbo.

The first ruling came from U.S. Court of Appeals for the D.C. Circuit. The judges declared Obamacare subsidies to states relying on federal exchanges illegal, which will deter the new enrollees these hospital companies are counting on.

HCA and Tenet are especially facing some turbulence as both companies currently maintain around 86% of their hospital beds in states in which subsidies were declared illegal, according to Susquehanna.

For now, no one will have their subsidies cut off while the legal battle continues. There are several more lawsuits coming in which the Obama administration's authority to grant subsidies will be challenged, however. Health reform is far from out of the woods regardless, especially with mid-term elections approaching.

The impact
The impact of changes in Obamacare on hospital companies is hard to quantify as hard numbers on the Affordable Care Act's specific contributions to revenue are unavailable. Nonetheless, Medicaid expansion has contributed to HCA's sharp gains. Along with core growth from higher hospital admissions, Medicaid expansion is a catalyst to the company.

As you can imagine, reforms under ACA have gone a long way toward reducing bad debt problems associated with hospitals. Obamacare has greatly reduced the number of uninsured people who are being treated, and that extra revenue is flowing straight to the bottom line of the hospital services sector. That's one reason that there will likely be multiple earnings "surprises" from hospital companies in the weeks ahead.

The ranks of the insured are expected to increase substantially this year. There may be more trading potential in this sector, but a problem is festering: simply, the stock market hates uncertainty.

While it seems highly unlikely that Obamacare will be dismantled in the foreseeable future, just the perception of it is enough to cause plenty of damage to companies like HCA that will catch the brunt of the storm.

To my mind, HCA is the best of the hospital stocks, with strengths in management and operational expertise. HCA has managed to prosper by leveraging its competitive technology and price advantages in size and scale, and its continued progress there should be watched closely. But keep another eye on the headlines, as the fate of this sector and the perceived fate of various provisions of the Affordable Care Act are joined at the hip, at least for now.