One way to estimate the credit risk of a bond is to look at the price of insuring the bond using a Credit Default Swap, which will cost roughly the spread between the bond's yield and the yield of a risk free bond with the same maturity (typically we use a government bond here).
Using simple assumptions, this leads us to the Credit Triangle,
$$K = (1-R)\lambda$$
where $K$ is the credit spread, $R$ is the recovery-given-default (ie. what you expect to get back out of 100 if there's a credit event), and $\lambda$ is the probability of default per unit time. Given any two of these by the market, we can calculate the third.
Note that if we can only see $K$, we need to make some assumptions about either $R$ or $\lambda$ - the market will charge the same for a bond with high probability of default but low loss-given-default as it will for a bond with low probability of default but high loss-given-default.
If you want to calculate CVA of a contract expiring at time $T_f$, that is typically done using either the credit spreads from either CDS contracts or calculated spreads between the company's bonds and the risk free bonds to calculate values for $R$ and $\lambda$, and then solving
$$CVA = (1-R) \int_0^{T_f} EPE(t) \cdot P(0,t) \cdot S'(t) dt$$
where $S'(t)$ is the derivative of the probability of survival until $t$ (depends on modelling assumptions, but this often assumed to be $-\lambda e^{-\lambda t}$), $P(0,t)$ is the discount factor to time $t$, and $EPE(t)$ is the expected positive exposute at time $t$. This complicates things a bit (especially of $S$ and $EPE$ are correlated...) and turns CVA calculations even for simple instruments into a derivtives pricing problem - the procedure is discussed in more depth in this article