Fault codes never say to replace parts. They only indicate the circuit or system that needs further diagnosis. About half the time a new sensor won't solve the problem.
If they retrieved a fault code for the camshaft position sensor, why would you doubt that? A professional will always troubleshoot the circuit first to eliminate other potential causes. Do-it-yourselfers typically just throw a new part on and hope it helps, but that can introduce new variables into the mix. In this case, however, when it's intermittent and acts up so infrequently, simply replacing it is often the easiest test. If the problem no longer occurs, you fixed it. If it still acts up, you know you have to keep looking.