Can i yoink a smd atmega328 from arduino so it will have code inside
I assume you mean "remove". Then YES you can once you code the AT328 it will remain.
If I had to do this I would use a flat heated plate. Get it hot enough to melt solder.
Hold the board above this plate for a few minutes. I use long toothpicks. This allows the board to warm a little so there is only a little thermal shock when you drop it on the heated plate.
Watch the shinyness of the solder, when it starts to get soft pull the chip off the board.
You will have to be creative on how you grab the chip and hold the board down at the same time.
Thank You. I am working on pcb stuff and it needs to be small.
If you can possibly fit it, I would make the programming pins available if only on a small pad. i.e. you can connect two wires to the ends of a 0805 and not install the component. That will give you at least some method of programming later.
While it's technically possible to transfer a programmed SMD device to another board, the more sensible approach would be to program the device on the other board. One approach would be to duplicate the ISCP programming interface per the Arduino reference schematics and use an ISCP programmer and the Arduino development environment.
This has the advantage of allowing changes to the program without desoldering. Also, the heat of soldering can impact the program flash memory data retention time.