Execute sp_update_jobstep to change SQL Agent job step type
You can use the @subsystem=N'TSQL' parameter of the sp_update_jobstep to alter the Step-Type.  Refer to sp_add_jobstep for a list of valid subsystem values.

Example:

EXEC msdb.dbo.sp_update_jobstep @job_name = N'test'
    ,@step_id = 1
    ,@subsystem = N'TSQL'
    ,@command = N'EXECUTE [dbo].[IndexOptimize], @Databases = ''USER_DATABASES'', @LogToTable = ''Y'', @LockTimeOut = 300'