It depends. If a vehicle is onboard programmable, this means its keyfobs come with programming instructions and can be programmed by the user without taking it to a locksmith or dealer. Some stores will help you with that programming. But the stock they have is limited. Only a few vehicle have on board programming (OBP), and a majority of remotes have to be done at the dealership or a certified locksmith with the proper equipment to get into the vehicles computer and memory to coordinate the codes within.
Going to a dealer will generally cost you more than to a locksmith and its quite often twice as much as what the locksmith would charge. Locksmiths will cost you less time with no hidden or additional fees but you also need to make sure that youre dealing with a licensed one. The dealership has a huge showroom facility they must maintain, and a locksmith just has their small shop. So, they can pass the savings on to you.
Locksmiths are specialists that handles both the remotes and the keys involved with starting and securing your vehicle. If there are any tricks or difficulties that each car can present, they will be able to address them quicker than a dealer that doesn’t come across them every day.