Define optimize. Do you want to rebuild the indexes? If so than either use a maintenance plan and schedule it, or grab one of the many tools to help you do this (some are free, some aren’t) and schedule them to run from a SQL Agent job.
If you are talking about adding indexes, changing the schema of the tables, etc. you’ll have to do that manually (or at least you should).