How to check the p values of parameters in OLS
The p-value corresponds to the probability of observing this value of a under the null hypothesis (which is typically 0 as this is the case when there is no effect of the covariate x on the outcome y).
This is under the assumptions of linear regression which among other things state that a follows a normal distribution. Therefore, if you really want to change your null hypothesis to be a=2 then just transform a such that a_ = a - 2 now when a=2, a_ will be 0 as per the usual assumption.
So you can achieve this by solving for y+2x = a_*x + b and you will have a p-value for the probability that a=2 would occur by chance. As I said though this is a fairly unusual test...
When running a linear regression, like y=a*x+b, the summary gives me the p-values of whether the parameters equal to zero, what if I would like to see the p-value of whether the parameter a equals to 2 or something different from zero?
I expect the OLS summary gives me the p value of whether a is different from 2.