Rebuilding indexes on a list of tables
(Edited to include earlier comments for clarity of the answer.)

A better plan for database maintenance is to implement Ola Hallengren's Maintenance Plan. This is free and can be downloaded from https://ola.hallengren.com  

You can configure the settings to suit your needs. Brent Ozar suggests some minor parameter tweaks at:  http://www.brentozar.com/archive/2014/12/tweaking-defaults-ola-hallengrens-maintenance-scripts/   

Because you are using SQL Server Express, which has no SQL Server Agent, you will need to use an alternate approach to running those jobs. 

If you go to Ola Hallengren's site, https://ola.hallengren.com/frequently-asked-questions.html, you can look at his answer:



Therefore, the execution of the stored procedures must be scheduled by using cmd files and Windows Scheduled Tasks. Follow these steps.


Download MaintenanceSolution.sql.
Execute MaintenanceSolution.sql. This script creates the stored procedures that you need.
Create cmd files to execute the stored procedures; for example a script:

sqlcmd -E -S .\SQLEXPRESS -d master -Q "EXECUTE dbo.DatabaseBackup 
@Databases = 'USER_DATABASES', @Directory = N'C:\Backup', 
@BackupType = 'FULL'" -b -o C:\Log\DatabaseBackup.txt
In Windows Scheduled Tasks, create tasks to call the cmd files.
Schedule the tasks.
Start the tasks and verify that they are completing successfully.




Mladen Prajdić also wrote a solution some years ago using Service Broker, which is available in SQL Server Express.  See the links at:


http://www.sqlteam.com/article/scheduling-jobs-in-sql-server-express
http://www.sqlteam.com/article/scheduling-jobs-in-sql-server-express-2


If you like that solution then you should be able to keep all the configuration inside the SQL Server.