Software stocks are on sale in 2022. Valuations slumped across the board following spiking stock prices in 2021. That previous rally was built on the assumption that demand for software services would continue soaring as it did in earlier phases of the pandemic.

That's not happening. But many software specialists are still posting strong growth in attractive markets like productivity and cybersecurity.

With that in mind, let's look at two growing, profitable tech stocks as potential investments today. Microsoft (MSFT 0.92%) has a huge sales base and pays a growing dividend. Palo Alto Networks (PANW 2.99%) recently achieved profitability and is targeting increasing margins from here.

But which of the two stocks is more attractive today?

Growth and profits

Palo Alto Networks isn't nearly as diverse or well-established as Microsoft. But the flip side of that smaller profile is the possibility of stronger growth. Sales jumped 25% in the most recent quarter, in fact, thanks to robust demand for cybersecurity services.

Microsoft is also enjoying booming demand in its cloud services segment. But declines in areas like gaming and PC software pushed overall growth down to just 16% in the most recent quarter.

The software giant trounces Palo Alto Networks -- and most other peers -- when it comes to profitability. Microsoft's operating profit in its most recent quarter landed at $21.6 billion, or a blazing 43% of sales. Palo Alto Networks' comparable quarterly figure was just $15 million, or 1% of sales.

The big differences

Both stocks are valued at roughly the same price-to-sales ratio of 9 times annual earnings. But you're getting a much different type of investment depending on which software stock you pick.

Microsoft is especially attractive if you are partial to cash. The company had over $100 billion on its books as of late September and generated over $20 billion in operating cash flow in just the most recent quarter.

In contrast, Palo Alto Networks has only seen two quarters of profitability in the last several years. Most of its cash is also going toward the business, while Microsoft can afford to pay a growing dividend while repurchasing shares at an aggressive clip.

The growth story

The main attraction for Palo Alto Networks is its potential to become a much bigger business over time. Its last two quarters of profitability might just be the start of a long streak of expanding margins. The company has a shot at expanding its market share in the cybersecurity industry, too. Enterprises have demonstrated a willingness to prioritize spending on its platform even as they make cuts in other parts of the budget.

More success in that area could allow the company to achieve much higher sales over time than the $7 billion that management is targeting for fiscal 2023. Executives are expecting to expand at a 25% pace this year, while Microsoft is targeting about 12% growth after accounting for currency exchange rate shifts.

A Microsoft investment is much less risky thanks to factors like its massive global sales footprint, cash flow, and dividend payment. However, if you're looking for more targeted exposure to cybersecurity, and the potential for accelerating earnings growth over the next few years, then Palo Alto Networks should be your choice right now.